package org.aldar.bquest.util;

import org.aldar.bquest.constants.IConstants;
import org.aldar.bquest.profile.GameProfile;
import org.aldar.bquest.resources.ResourceManager;
import org.aldar.bquest.screens.MainBoardScreen;
import org.andengine.entity.text.Text;

import java.util.HashMap;
import java.util.Map;

/**
 * User: Daria
 * Date: 1/31/14 10:01 PM
 */
public class TestUtil {

    private Map<String, Text> textsMap = new HashMap<String, Text>();

    private static TestUtil instance;

    public TestUtil() {
        instance = this;
    }

    public static TestUtil getInstance() {
        return instance;
    }

    public void updateText(String title, String content) {
        /*
        Text myText = textsMap.get(title);
        if (myText == null) {
            myText = new Text(10, 200 + 15 * textsMap.size(), ResourceManager.getInstance().getmFont(), title + ": " + content, 1000, MainBoardScreen.getScm().getVertexBufferObjectManager());
            MainBoardScreen.getScm().getTestLayer().attachChild(myText);
            myText.setAnchorCenter(0, 0);
            myText.setAlpha(0f);
            textsMap.put(title, myText);
        } else {
            myText.setText(title + ": " + content);
        }               */
    }

    public void addTurn() {
        Text myText = textsMap.get("turns");
        if (myText == null) {
            myText = new Text(10, IConstants.CAMERA_HEIGHT - 100, ResourceManager.getInstance().getBigFont(), "Turns: " + GameProfile.getCurrentLevelProfile().getTurnsPerformed(), 100, MainBoardScreen.getScm().getVertexBufferObjectManager());
            //MainBoardScreen.getScm().getTestLayer().attachChild(myText);
            myText.setAnchorCenter(0, 0);
            myText.setScale(3f);
            textsMap.put("turns", myText);
        } else {
            myText.setText("Turns: " + GameProfile.getCurrentLevelProfile().getTurnsPerformed());
        }
    }
}
